package sctu.edu.java.year2016.team04.Liliang.day20160523.chapter5_2;

/**
 * Created by asus on 2016/5/23.
 * 编写Java程序，创建一维数组arr[]，将数组中最大的数输出。
 */
public class date_max {
    public static void main(String[] args) {
        int arr[] = {2,4,5,34,54,2};
        System.out.println("输出一维数组:");
        for (int i = 0;i < arr.length;i++){
            System.out.println(arr[i]);
        }
        int max = arr[0];
        for (int j = 0;j<arr.length-1;j++){
            while (max < arr[j+1]){
                max = arr[j+1];
            }
        }
        System.out.println("最大数是："+max);
    }
}
